package edu.hitsz.prop;

import edu.hitsz.aircraft.HeroAircraft;
import edu.hitsz.shoot.ShootDirect;
import edu.hitsz.shoot.ShootScatter;

import static java.lang.Thread.sleep;

public class BulletProp extends BaseProp {
    public BulletProp(int locationX, int locationY, int speedX, int speedY) {
        super(locationX, locationY, speedX, speedY);
    }

    public void Active(HeroAircraft heroAircraft) {
        System.out.println("FireSupply active!");
        get_supply_sound();
        vanish();
        Runnable r = () -> {
            heroAircraft.setShoot(new ShootScatter());
            try {
                sleep(5000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            heroAircraft.setShoot(new ShootDirect());
        };
        new Thread(r).start();
    }
}